libxenguest: Revert domain builder interface changes for 'superpages'
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 20 Jul 2009 14:45:50 +0000 (15:45 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 20 Jul 2009 14:45:50 +0000 (15:45 +0100)
parameter, and place the flag in a pad byte of 'struct xc_dom_image'
instead.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/libxc/xc_dom.h
tools/libxc/xc_dom_boot.c
tools/libxc/xc_dom_compat_linux.c
tools/libxc/xc_dom_ia64.c
tools/libxc/xc_dom_x86.c
tools/libxc/xenguest.h
tools/python/xen/lowlevel/xc/xc.c

index 3d6d9164bd5a3257bd6ee5a00befbfb4d5712e3a..58d3f496de9f2105ee2a487b9cdf9bb887cb054d 100644 (file)
@@ -96,6 +96,7 @@ struct xc_dom_image {
     int guest_xc;
     domid_t guest_domid;
     int8_t vhpt_size_log2; /* for IA64 */
+    int8_t superpages;
     int shadow_enabled;
 
     int xen_version;
@@ -174,7 +175,7 @@ int xc_dom_build_image(struct xc_dom_image *dom);
 int xc_dom_update_guest_p2m(struct xc_dom_image *dom);
 
 int xc_dom_boot_xen_init(struct xc_dom_image *dom, int xc, domid_t domid);
-int xc_dom_boot_mem_init(struct xc_dom_image *dom, int superpages);
+int xc_dom_boot_mem_init(struct xc_dom_image *dom);
 void *xc_dom_boot_domU_map(struct xc_dom_image *dom, xen_pfn_t pfn,
                            xen_pfn_t count);
 int xc_dom_boot_image(struct xc_dom_image *dom);
@@ -260,7 +261,7 @@ static inline xen_pfn_t xc_dom_p2m_guest(struct xc_dom_image *dom,
 
 /* --- arch bits --------------------------------------------------- */
 
-int arch_setup_meminit(struct xc_dom_image *dom, int superpages);
+int arch_setup_meminit(struct xc_dom_image *dom);
 int arch_setup_bootearly(struct xc_dom_image *dom);
 int arch_setup_bootlate(struct xc_dom_image *dom);
 
index ac192a3dac1d03a4715470d03ca610ee296cdcb1..e767e8cee10f297eb234708f7c62baf195f53bd7 100644 (file)
@@ -129,13 +129,13 @@ int xc_dom_boot_xen_init(struct xc_dom_image *dom, int xc, domid_t domid)
     return 0;
 }
 
-int xc_dom_boot_mem_init(struct xc_dom_image *dom, int superpages)
+int xc_dom_boot_mem_init(struct xc_dom_image *dom)
 {
     long rc;
 
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
-    rc = arch_setup_meminit(dom, superpages);
+    rc = arch_setup_meminit(dom);
     if ( rc != 0 )
     {
         xc_dom_panic(XC_OUT_OF_MEMORY,
index 41ee3af6348aec1417ae5de0731a8ff3d31eef15..c00cd5abcd36ecd47480e8de9ae2417de2f30590 100644 (file)
@@ -28,8 +28,7 @@ static int xc_linux_build_internal(struct xc_dom_image *dom,
                                    unsigned int store_evtchn,
                                    unsigned long *store_mfn,
                                    unsigned int console_evtchn,
-                                   unsigned long *console_mfn,
-                                                          int superpages)
+                                   unsigned long *console_mfn)
 {
     int rc;
 
@@ -43,7 +42,7 @@ static int xc_linux_build_internal(struct xc_dom_image *dom,
         goto out;
     if ( (rc = xc_dom_mem_init(dom, mem_mb)) != 0 )
         goto out;
-    if ( (rc = xc_dom_boot_mem_init(dom, superpages)) != 0 )
+    if ( (rc = xc_dom_boot_mem_init(dom)) != 0 )
         goto out;
     if ( (rc = xc_dom_build_image(dom)) != 0 )
         goto out;
@@ -68,8 +67,8 @@ int xc_linux_build_mem(int xc_handle, uint32_t domid,
                        unsigned long flags,
                        unsigned int store_evtchn,
                        unsigned long *store_mfn,
-                       unsigned int console_evtchn, unsigned long *console_mfn,
-                       int superpages)
+                       unsigned int console_evtchn,
+                       unsigned long *console_mfn)
 {
     struct xc_dom_image *dom;
     int rc;
@@ -84,7 +83,7 @@ int xc_linux_build_mem(int xc_handle, uint32_t domid,
     rc = xc_linux_build_internal(dom, xc_handle, domid,
                                  mem_mb, flags,
                                  store_evtchn, store_mfn,
-                                 console_evtchn, console_mfn, superpages);
+                                 console_evtchn, console_mfn);
 
  out:
     xc_dom_release(dom);
@@ -100,8 +99,8 @@ int xc_linux_build(int xc_handle, uint32_t domid,
                    unsigned long flags,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
-                   unsigned int console_evtchn, unsigned long *console_mfn,
-                   int superpages)
+                   unsigned int console_evtchn,
+                   unsigned long *console_mfn)
 {
     struct xc_dom_image *dom;
     int rc;
@@ -117,7 +116,7 @@ int xc_linux_build(int xc_handle, uint32_t domid,
     rc = xc_linux_build_internal(dom, xc_handle, domid,
                                  mem_mb, flags,
                                  store_evtchn, store_mfn,
-                                 console_evtchn, console_mfn, superpages);
+                                 console_evtchn, console_mfn);
 
  out:
     xc_dom_release(dom);
@@ -133,8 +132,7 @@ int xc_dom_linux_build(int xc_handle,
                        unsigned long flags,
                        unsigned int store_evtchn,
                        unsigned long *store_mfn,
-                       unsigned int console_evtchn, unsigned long *console_mfn,
-                       int superpages)
+                       unsigned int console_evtchn, unsigned long *console_mfn)
 {
     int rc;
 
@@ -147,7 +145,7 @@ int xc_dom_linux_build(int xc_handle,
     return xc_linux_build_internal(dom, xc_handle, domid,
                                    mem_mb, flags,
                                    store_evtchn, store_mfn,
-                                   console_evtchn, console_mfn, superpages);
+                                   console_evtchn, console_mfn);
 }
 
 /*
index 2d4086e41dd0818ef72fbf4e3a9e73a27645bce1..f5d4418077bb973169d05fd9a39cd1839d90acc1 100644 (file)
@@ -149,7 +149,7 @@ static void __init register_arch_hooks(void)
 
 #include "xc_efi.h"
 
-int arch_setup_meminit(struct xc_dom_image *dom, int superpages)
+int arch_setup_meminit(struct xc_dom_image *dom)
 {
     xen_pfn_t pfn;
     int rc;
index 30f13970ac43c45bc948196c75e284028cdc01c8..eddb93aef51f8d315112ad1fff1820af4ab9a73c 100644 (file)
@@ -694,10 +694,10 @@ static int x86_shadow(int xc, domid_t domid)
     return rc;
 }
 
-int arch_setup_meminit(struct xc_dom_image *dom, int superpages)
+int arch_setup_meminit(struct xc_dom_image *dom)
 {
     int rc;
-    xen_pfn_t pfn, allocsz, i;
+    xen_pfn_t pfn, allocsz, i, j, mfn;
 
     rc = x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
     if ( rc )
@@ -711,47 +711,46 @@ int arch_setup_meminit(struct xc_dom_image *dom, int superpages)
     }
 
     dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
-    if (superpages)
+    if ( dom->superpages )
     {
         int count = dom->total_pages >> SUPERPAGE_PFN_SHIFT;
         xen_pfn_t extents[count];
 
         xc_dom_printf("Populating memory with %d superpages\n", count);
-        for (pfn = 0; pfn < count; pfn++)
+        for ( pfn = 0; pfn < count; pfn++ )
             extents[pfn] = pfn << SUPERPAGE_PFN_SHIFT;
         rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
                                                count, SUPERPAGE_PFN_SHIFT, 0,
                                                extents);
-        if (!rc)
-        {
-            int i, j;
-            xen_pfn_t mfn;
+        if ( rc )
+            return rc;
 
-            /* Expand the returned mfn into the p2m array */
-            pfn = 0;
-            for (i = 0; i < count; i++)
-            {
-                mfn = extents[i];
-                for (j = 0; j < SUPERPAGE_NR_PFNS; j++, pfn++)
-                {
-                    dom->p2m_host[pfn] = mfn + j;
-                }
-            }
+        /* Expand the returned mfn into the p2m array */
+        pfn = 0;
+        for ( i = 0; i < count; i++ )
+        {
+            mfn = extents[i];
+            for ( j = 0; j < SUPERPAGE_NR_PFNS; j++, pfn++ )
+                dom->p2m_host[pfn] = mfn + j;
         }
-    } else
+    }
+    else
     {
         /* setup initial p2m */
         for ( pfn = 0; pfn < dom->total_pages; pfn++ )
             dom->p2m_host[pfn] = pfn;
         
         /* allocate guest memory */
-        for ( i = rc = allocsz = 0; (i < dom->total_pages) && !rc; i += allocsz )
+        for ( i = rc = allocsz = 0;
+              (i < dom->total_pages) && !rc;
+              i += allocsz )
         {
             allocsz = dom->total_pages - i;
             if ( allocsz > 1024*1024 )
                 allocsz = 1024*1024;
             rc = xc_domain_memory_populate_physmap(
-                dom->guest_xc, dom->guest_domid, allocsz, 0, 0, &dom->p2m_host[i]);
+                dom->guest_xc, dom->guest_domid, allocsz,
+                0, 0, &dom->p2m_host[i]);
         }
     }
 
index 220db7061c9d614348b8df954da936768f808936..03bc38cb6ab11c06aff8e451c9fb248eac337497 100644 (file)
@@ -63,7 +63,6 @@ int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
  * @parm store_mfn returned with the mfn of the store page
  * @parm console_evtchn the console event channel for this domain to use
  * @parm conole_mfn returned with the mfn of the console page
- * @parm superpages populate memory in guest with superpages
  * @return 0 on success, -1 on failure
  */
 int xc_linux_build(int xc_handle,
@@ -77,8 +76,7 @@ int xc_linux_build(int xc_handle,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
                    unsigned int console_evtchn,
-                   unsigned long *console_mfn,
-                  int superpages);
+                   unsigned long *console_mfn);
 
 /** The same interface, but the dom structure is managed by the caller */
 struct xc_dom_image;
@@ -92,8 +90,7 @@ int xc_dom_linux_build(int xc_handle,
                       unsigned int store_evtchn,
                       unsigned long *store_mfn,
                       unsigned int console_evtchn,
-                      unsigned long *console_mfn,
-                       int superpages);
+                      unsigned long *console_mfn);
 
 /**
  * This function will create a domain for a paravirtualized Linux
@@ -112,7 +109,6 @@ int xc_dom_linux_build(int xc_handle,
  * @parm store_mfn returned with the mfn of the store page
  * @parm console_evtchn the console event channel for this domain to use
  * @parm conole_mfn returned with the mfn of the console page
- * @parm superpages populate memory in guest with superpages
  * @return 0 on success, -1 on failure
  */
 int xc_linux_build_mem(int xc_handle,
@@ -128,8 +124,7 @@ int xc_linux_build_mem(int xc_handle,
                        unsigned int store_evtchn,
                        unsigned long *store_mfn,
                        unsigned int console_evtchn,
-                       unsigned long *console_mfn,
-                       int superpages);
+                       unsigned long *console_mfn);
 
 int xc_hvm_build(int xc_handle,
                  uint32_t domid,
index 02505aefece2dfcf9b6ec8ac5e61d52f3f283bcb..c33fcc3b9c6ad59a27ab891aa2a3564f87fdb415 100644 (file)
@@ -436,9 +436,11 @@ static PyObject *pyxc_linux_build(XcObject *self,
     /* for IA64 */
     dom->vhpt_size_log2 = vhpt;
 
+    dom->superpages = superpages;
+
     if ( xc_dom_linux_build(self->xc_handle, dom, domid, mem_mb, image,
                             ramdisk, flags, store_evtchn, &store_mfn,
-                            console_evtchn, &console_mfn, superpages) != 0 ) {
+                            console_evtchn, &console_mfn) != 0 ) {
         goto out;
     }